<?php

namespace App\Controllers;
use App\Models;
class Doc extends \Core\Controller
{
    function docTypeAction(){
        $docModel = new Models\Doc();
        $types = $docModel->getTypes();
        $type = json_encode($types,JSON_FORCE_OBJECT);
        $this->JsonResp(200,$type,"ok");
    }
    public function docsAction(){
        if(isset($this->input->id)){
            $docs = new Models\Doc();
            $ret = $docs->docs($this->input->id);
            $this->JsonResp(200,$ret,"OK");
        }else{
            $this->JsonResp(200,null,"error");
        }
    }
    public function  docAction(){
        if(isset($this->input->id)) {
            $docs = new Models\Doc();
            $ret = $docs->doc($this->input->id);
            $this->JsonResp(200,$ret,"OK");
        }else{
            $this->JsonResp(200,null,"error");
        }
    }

}